/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.me.nicefotoappcamp.core;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import java.io.ByteArrayInputStream;
import java.util.ArrayList;

/**
 *
 * @author Tadas
 */
public class Picture {
    private byte[] picture;
    private int userId;
    private int rating;
    private ArrayList<Comment> comments;

    public Picture(byte [] picture, int userId, int rating, ArrayList<Comment> comments){
        this.picture = picture;
        this.userId = userId;
        this.rating = rating;
        this.comments = comments;
    }

    /**
     * @return the picture
     */
    public byte[] getPictureBytes() {
        return picture;
    }

    public Bitmap getBitmap(){
        return BitmapFactory.decodeStream(new ByteArrayInputStream(this.getPictureBytes()));
    }

    /**
     * @return the userId
     */
    public int getUserId() {
        return userId;
    }

    /**
     * @return the rating
     */
    public int getRating() {
        return rating;
    }

    /**
     * @return the comments
     */
    public ArrayList<Comment> getComments() {
        return comments;
    }

    /**
     * @param comments the comments to set
     */
    public void setComments(ArrayList<Comment> comments) {
        this.comments = comments;
    }
}
